@echo off

if exist "%HOMEDRIVE%\MinGW\bin\gcc.exe" goto :gcc
if exist "%HOMEDRIVE%\cygwin\bin\gcc.exe" goto :gcc
goto :eof

:gcc

cd src\pattern\pcre

if exist dftables.c gcc dftables.c -o dftables.exe
if exist dftables.exe dftables.exe pcre_chartables.c
if exist dftables.exe del dftables.exe

cd ..\..\..

gcc -static -Ofast -march=corei7 -Wno-trigraphs src/pattern/ProcPat.c src/pattern/51Degrees.mobi.c src/pattern/pcre/pcre_chartables.c src/pattern/pcre/pcre_compile.c src/pattern/pcre/pcre_config.c src/pattern/pcre/pcre_dfa_exec.c src/pattern/pcre/pcre_exec.c src/pattern/pcre/pcre_fullinfo.c src/pattern/pcre/pcre_get.c src/pattern/pcre/pcre_globals.c src/pattern/pcre/pcre_info.c src/pattern/pcre/pcre_maketables.c src/pattern/pcre/pcre_newline.c src/pattern/pcre/pcre_ord2utf8.c src/pattern/pcre/pcre_refcount.c src/pattern/pcre/pcre_study.c src/pattern/pcre/pcre_tables.c src/pattern/pcre/pcre_try_flipped.c src/pattern/pcre/pcre_ucp_searchfuncs.c src/pattern/pcre/pcre_valid_utf8.c src/pattern/pcre/pcre_version.c src/pattern/pcre/pcre_xclass.c src/pattern/pcre/pcreposix.c src/pattern/snprintf/snprintf.c -o ProcPat.exe
gcc -static -Ofast -march=corei7 -Wno-trigraphs src/pattern/PerfPat.c src/pattern/51Degrees.mobi.c src/pattern/pcre/pcre_chartables.c src/pattern/pcre/pcre_compile.c src/pattern/pcre/pcre_config.c src/pattern/pcre/pcre_dfa_exec.c src/pattern/pcre/pcre_exec.c src/pattern/pcre/pcre_fullinfo.c src/pattern/pcre/pcre_get.c src/pattern/pcre/pcre_globals.c src/pattern/pcre/pcre_info.c src/pattern/pcre/pcre_maketables.c src/pattern/pcre/pcre_newline.c src/pattern/pcre/pcre_ord2utf8.c src/pattern/pcre/pcre_refcount.c src/pattern/pcre/pcre_study.c src/pattern/pcre/pcre_tables.c src/pattern/pcre/pcre_try_flipped.c src/pattern/pcre/pcre_ucp_searchfuncs.c src/pattern/pcre/pcre_valid_utf8.c src/pattern/pcre/pcre_version.c src/pattern/pcre/pcre_xclass.c src/pattern/pcre/pcreposix.c src/pattern/snprintf/snprintf.c -o PerfPat.exe
gcc -static -Ofast -march=corei7 src/trie/ProcTrie.c src/trie/51Degrees.mobi.c src/trie/snprintf/snprintf.c -o ProcTrie.exe
gcc -static -Ofast -march=corei7 src/trie/PerfTrie.c src/trie/51Degrees.mobi.c src/trie/snprintf/snprintf.c -o PerfTrie.exe

:eof
